package com.xiaoyu.izf.aspect;

import com.xiaoyu.izf.model.exception.BusinessException;
import com.xiaoyu.izf.model.page.FormResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionAspect {

    /**
     * 全局业务异常
     * @param e
     * @return
     */
    @ExceptionHandler(value={BusinessException.class})
    public FormResult exceptionHandler(BusinessException e){

        return new FormResult(e.getCode(),e.getMessage(),null);
    }
}
